package day12test;

import java.util.ArrayList;
import java.util.Scanner;

public class Test4 {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            Student s = new Student();
            Scanner sc = new Scanner(System.in);
            System.out.println("请输入学生的姓名");
            String name = sc.next();
            System.out.println("请输入学生年龄");
            int age = sc.nextInt();
            s.setName(name);
            s.setAge(age);
            list.add(s);
        }
        for (int i = 0; i < list.size(); i++) {
            Student ssr = list.get(i);
            System.out.println(ssr.getName() +"," + ssr.getAge());
        }
    }
}
